﻿@page "/blazor/examples/page-stack/tab3"
@using Masa.Blazor.Presets.PageStack.NavController
@layout PageStackLayout
@inject PageStackNavController NavController
@implements IDisposable

<p class="caption">url: /blazor/examples/page-stack/tab3</p>

<p class="text-h5">Tab 3 created at @(DateTimeOffset.UtcNow.ToString("HH:mm:ss zz"))</p>

<p>
    <MChip Label Color="primary">Persistent</MChip>
    <MChip Label Disabled Class="text-decoration-line-through" Color="primary">Self</MChip>
</p>

<PPageStackLink Href="/blazor/examples/page-stack/page1">Navigate to Page 1</PPageStackLink>

<MSyntaxHighlight Code="@sourceCode"
                  Language="html"
                  Style="font-size: 10px">
</MSyntaxHighlight>

@code {

    protected override void OnInitialized()
    {
        base.OnInitialized();

        NavController.PageClosed += NavControllerOnPageClosed;
    }

    private void NavControllerOnPageClosed(object? sender, PageStackPageClosedEventArgs e)
    {
        Console.Out.WriteLine($"{e.RelativeUri} closed");
    }

    public void Dispose()
    {
        NavController.PageClosed -= NavControllerOnPageClosed;
    }

}